<jsp:include page="logincheck.jsp" />
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ page import="java.util.*" %>

<jsp:useBean id="dp" class="se2.DiscountPlan" scope="request"/>
<jsp:setProperty name="dp" property="*"/>

<% dp.loadAllInformation(); %>

<html>

	<head>
		<title>Administration Console</title>
		<link rel="stylesheet" href="default.css" type="text/css" media="screen"></link>
		<script type="text/javascript" language="javascript" src="addDiscountPlan.js"></script>
	</head>

	<body>
		<div id="container">
			<div id="navigation">
<p>&nbsp;</p>
<jsp:include page="navigation.jsp" />
			</div>
			
			<div id="header">				
				<img src="images/header.png" />
			</div>

			<div id="content">
<!-- Main code -->

<h1>Customer Accounts :: Edit Discount Plan</h1>

<form method="post" action="editBillingPlanFunction.jsp" name="addBillingPlan" onSubmit="return validate();">
	<input type="hidden" name="id" value="<%= request.getParameter("id") %>" />
	
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr style="background-image: url('images/tableBackground.png');">
			<td width="100" class="tableHeader">Plan name:</td>
			<td><input class="textField" type="text" id="name" name="name" value="<%= dp.getName() %>" onClick="this.style.background='#efefef';" onBlur="this.style.background='#fff';"></td>
		</tr>
		
		<tr>
			<td class="tableHeader">Start Date:</td>
			<td>
				<select id="startDay" name="startDay">
					<option value="monday" <% if (dp.getStartDay().equals("monday")) { %>selected<% } %>>Monday</option>
					<option value="tuesday" <% if (dp.getStartDay().equals("tuesday")) { %>selected<% } %>>Tuesday</option>
					<option value="wednesday" <% if (dp.getStartDay().equals("wednesday")) { %>selected<% } %>>Wednesday</option>
					<option value="thursday" <% if (dp.getStartDay().equals("thursday")) { %>selected<% } %>>Thursday</option>
					<option value="friday" <% if (dp.getStartDay().equals("friday")) { %>selected<% } %>>Friday</option>
					<option value="saturday" <% if (dp.getStartDay().equals("saturday")) { %>selected<% } %>>Saturday</option>
					<option value="sunday" <% if (dp.getStartDay().equals("sunday")) { %>selected<% } %>>Sunday</option>
				</select>
				
				@
				
				<select id="startHour" name="startHour">
					<%
						for (int i = 0; i < 24; i++)
						{
					%>
							<option value="<%= i %>" <% if (dp.getStartTime().getHours() == i) { %>selected<% } %>><%= i %></option>
					<%
						}
					%>
				</select>
				
				:
				
				<select id="startMinute" name="startMinute">
					<%
						for (int i = 0; i < 60; i++)
						{
					%>
							<option value="<%= i %>" <% if (dp.getStartTime().getMinutes() == i) { %>selected<% } %>><%= i %></option>
					<%
						}
					%>
				</select>
			</td>
		</tr>
		
		<tr style="background-image: url('images/tableBackground.png');">
			<td class="tableHeader">End Date:</td>
			<td>
				<select id="endDay" name="endDay">
					<option value="monday" <% if (dp.getStartDay().equals("monday")) { %>selected<% } %>>Monday</option>
					<option value="tuesday" <% if (dp.getStartDay().equals("tuesday")) { %>selected<% } %>>Tuesday</option>
					<option value="wednesday" <% if (dp.getStartDay().equals("wednesday")) { %>selected<% } %>>Wednesday</option>
					<option value="thursday" <% if (dp.getStartDay().equals("thursday")) { %>selected<% } %>>Thursday</option>
					<option value="friday" <% if (dp.getStartDay().equals("friday")) { %>selected<% } %>>Friday</option>
					<option value="saturday" <% if (dp.getStartDay().equals("saturday")) { %>selected<% } %>>Saturday</option>
					<option value="sunday" <% if (dp.getStartDay().equals("sunday")) { %>selected<% } %>>Sunday</option>
				</select>
				
				@
				
				<select id="endHour" name="endHour">
					<%
						for (int i = 0; i < 24; i++)
						{
					%>
							<option value="<%= i %>" <% if (dp.getEndTime().getHours() == i) { %>selected<% } %>><%= i %></option>
					<%
						}
					%>
				</select>
				
				:
				
				<select id="endMinute" name="endMinute">
					<%
						for (int i = 0; i < 60; i++)
						{
					%>
							<option value="<%= i %>" <% if (dp.getEndTime().getMinutes() == i) { %>selected<% } %>><%= i %></option>
					<%
						}
					%>
				</select>
			</td>
		</tr>
		
		<tr>
			<td class="tableHeader">Rate:</td>
			<td><input class="textField" type="text" id="rate" name="rate" value="<%= dp.getRate() %>" onClick="this.style.background='#efefef';" onBlur="this.style.background='#fff';"></td>
		</tr>

		<tr style="background-image: url('images/tableBackground.png');">
			<td colspan="3">
				<p class="floatRight"><input type="submit" value="Edit Plan"></p>
			</td>
		</tr>
	</table>	
</form>

<!-- Main Code -->
			</div>

			<div id="footer">
<jsp:include page="footer.jsp" />
			</div>
		</div>
	</body>

</html>